{block name=body}
<div id="headout" class="headerbg">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                {include file='breadcrumbs.tpl'}
            </div>
        </div>
        <div class="row">
            <div class="col-sm-8">
                <h1 class="title" data-available="{$availability.available}" data-taken="{$availability.taken}">{$class_name}</h1> {assign var=term_shortname value="|"|explode:$term_name}
                <h3 class="title">{$term_shortname.0}</h3>
                <br>
                <p>该课程适合 {$agegroup_name}儿童</p>
                <p>{$class_content1}
                    <p>
                        <p class="small"><a href="{if $HTTP_REFERER|strstr:'/enrol/search?'}{$HTTP_REFERER}{else}/enrol{/if}">查看其它课程</a></p>
            </div>
            <div class="col-sm-4">
                {if $availability.available gt 0 && $smarty.now|date_format:"%Y%m%d" lte $term_end_date|date_format:"%Y%m%d" && $availability.weeks.0 > 0}
                <form class="form-horizontal" id="product-form" role="form" accept-charset="UTF-8" action="" method="post">
                    <input type="hidden" value="ADDTOCART" name="action" id="action" />
                    <input type="hidden" name="formToken" id="formToken" value="{$token}" />
                    <input type="hidden" value="{$classterm_id}" name="product_id" id="product_id" />
                    <input type="hidden" value="{$listing_parent.listing_object_id}" name="listing_id" id="listing_id" />
                    <input type="hidden" value="1" name="isClass" id="isClass" />
                    <input type="hidden" value="S" name="enrolment" id="enrolment" /> {foreach from=$availability.weeks key=k item=wk} {if $k eq 0}{assign var='firstwk' value=$wk}{/if}
                    <input type="hidden" value="{$wk}" name="attr[week][{$k}]" id="week_value{$wk}" /> {/foreach}
{assign var='weeks' value=count($availability.weeks)}
{assign var='classes' value=count($classtimes)}
                    <div class="col-sm-offset-2 text-center" id="priceblock">
{if $class_special_price eq '0.00'}
    {assign var='classtotal' value=$weeks*$classes*$class_price}
                        <div class="pricebig">{$CURRENCY_SYMBOL}{$classtotal|number_format:2:'.':','}</div>
                        <div style="display:inline;" class="pricecalc" id="cal-price" value="{$class_price}"></div>
                        <div class="blue small">剩余 {$weeks} 周课程</div>
{else}
    {assign var='classtotalOld' value=$weeks*$classes*$class_price}
    {assign var='classtotal' value=$weeks*$classes*$class_special_price}
                        <div class="pricebig" id="cal-price" value="{$class_special_price}">{$CURRENCY_SYMBOL}{$classtotal|number_format:2:'.':','} <span class="blue gst">含税</span></div>
                        <div class="blue small">剩余 {$weeks} 周课程</div>
                        <div class="small old-price">原价 {$CURRENCY_SYMBOL}{$classtotalOld|number_format:2:'.':','}</div>
                        <div class="special-banner">特价</div>
{/if}
                        <div style="display:inline;">
                            <input type="hidden" value="{$class_price}" name="price" id="price" />
                            <input type="hidden" value="1" name="quantity" id="quantity">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-10 col-sm-offset-2 text-center">
                            <button class="enrol" type="submit" onclick="$('#enrolment').val('S')"><span>{if $request.reenrol}再 次 报 名{else}现 在 报 名{/if}</span></button>
                            <span class="mini">或者</span>
                            <button class="enrol" type="button" onclick="$('#enrolment').val('T');$('#product-form').submit();"><span>预 约 体 验</span></button>
                            <div class="mini">该课程下一次体验时间为 {$availability.dates.0}。<a href="javascript:void(0)" onclick="$('#enrolment').val('T');$('#product-form').submit();">点击这里添加该免费体验课程到您的购物车</a></div>
                            {if ($smarty.now|date_format:"%Y%m%d" gte $term_start_date|date_format:"%Y%m%d") && ($class_weekday eq $smarty.now|date_format:"%A")}
                            <div class="class-notice">今天的课程不能在线预定。如果您想报名今天的课程，请致电 <a href="tel:{$PHONE}">{$PHONE}</a>.</div>
                            {/if}
                        </div>
                    </div>
                </form>
                {else}
                <div class="text-center">
                    <div class="text-danger">
                        <br><b>该课程 {if $availability.taken gt 0}报名已满{else}目前不可报名{/if}</b></div>
                    <small><div style="line-height:23px; margin-top:5px;">请联系我们 <a title="Click to call" href="tel:{$PHONE}">{$PHONE}</a>，咨询相关信息。</div></small>
                </div>
                {/if}
            </div>
        </div>
    </div>
</div>
<div class="container hidden-xs" id="sportstaught">
    <div class="row">
        <div class="col-sm-12">
            <span class="blue">该学期所授体育项目：</span>
            <br />
            <br />
        </div>
    </div>
    <div id="sportscopy">
        <div class="row">
{if $term_termcategory_id eq 1}
    {assign var="class_sports" value=$class_sports1}
{/if}
{if $term_termcategory_id eq 2}
    {assign var="class_sports" value=$class_sports2}
{/if}
{if $term_termcategory_id eq 3}
    {assign var="class_sports" value=$class_sports3}
{/if}
{if $term_termcategory_id eq 4}
    {assign var="class_sports" value=$class_sports4}
{/if}
{if $term_termcategory_id eq 5}
    {assign var="class_sports" value=$class_sports5}
{/if}
{if $class_sports neq 100}
            <div class="col-xs-6 col-sm-2 col-sm-offset-1 text-center">
                <img src="/images/athletics.png" alt="Athletics" />
                <div>田径</div>
            </div>
            <div class="col-xs-6 col-sm-2 text-center">
                <img src="/images/basketball.png" alt="Basketball" />
                <div>篮球</div>
            </div>
            <div class="col-xs-6 col-sm-2 text-center">
                <img src="/images/golf.png" alt="Golf" />
                <div>高尔夫</div>
            </div>
            <div class="col-xs-6 col-sm-2 text-center">
                <img src="/images/rugby.png" alt="Rugby" />
                <div>英式橄榄球</div>
            </div>
            <div class="col-xs-6 col-sm-2 text-center">
                <img src="/images/tball.png" alt="T-ball" />
                <div>儿童棒球</div>
            </div>
        <!-- </div>
        <div class="row"> -->
            <div class="col-xs-6 col-sm-2 col-sm-offset-1 text-center">
                <img src="/images/soccer.png" alt="Soccer" />
                <div>足球</div>
            </div>
            <div class="col-xs-6 col-sm-2 text-center">
                <img src="/images/tennis.png" alt="Tennis" />
                <div>网球</div>
            </div>
            <div class="col-xs-6 col-sm-2 text-center">
                <img src="/images/hockey.png" alt="Hockey" />
                <div>曲棍球</div>
            </div>
            <div class="col-xs-6 col-sm-2 text-center">
                <img src="/images/aflrugby.png" alt="AFL" />
                <div>澳式足球</div>
            </div>
            <div class="col-xs-6 col-sm-2 text-center">
                <img src="/images/cricket.png" alt="Cricket" />
                <div>板球</div>
            </div>
{/if}
            <div class="col-xs-6 col-sm-1 text-center">
                <a href="/our-program/sports">查看所有运动介绍</a>
            </div>
        </div>
    </div>
</div>
<div class="bluebg hidden-xs">
    <div class="container">
        <div class="row">
            <div class="col-sm-12 blue">
                课程详情：
                <br />
                <br />
            </div>
        </div>
        <div id="detcopy">
            <div class="row">
                <div class="col-sm-8">
                    <div class="row detrow">
                        <div class="col-sm-3 col-sm-offset-1">
                            上课时间：
                        </div>
                        <div class="col-sm-8">
                        {foreach $classtimes as $classtime}
                            {$ch_weekday[$classtime.classtime_weekday]}， {$classtime.classtime_start_time|date_format:"%H:%M"} - {$classtime.classtime_end_time|date_format:"%H:%M"}<br />
                        {/foreach}
                        </div>
                    </div>
                    <div class="row detrow">
                        <div class="col-sm-3 col-sm-offset-1">
                            上课地点：
                        </div>
                        <div class="col-sm-8">
                            {$location_name}
                            <br /> {$location_street} {$location_suburb} {$location_state} {$location_postcode}
                            <br />
                            <a href="javascript:void(0)" onclick="scrolltodiv('#map')"><span class="glyphicon glyphicon-map-marker f09em"></span> 查看地图</a>
                            <br /><span class="glyphicon glyphicon-info-sign f09em"></span> 所有课程都在室内进行
                        </div>
                    </div>
                    <div class="row detrow">
                        <div class="col-sm-3 col-sm-offset-1">
                            学期信息：
                        </div>
                        <div class="col-sm-8">
                            开始日期：{$term_start_date|date_format:"%Y-%m-%d"}
                            <br /> 结束日期：{$term_end_date|date_format:"%Y-%m-%d"}
                            <br /> {if $weeks gt 0}<span class="glyphicon glyphicon-calendar f09em"></span> 还剩余 {$weeks} 周课程{/if}
                        </div>
                    </div>
                    {if $products}
                    <div class="row detrow">
                        <div class="col-sm-3 col-sm-offset-1">
                            服装要求：
                        </div>
                        <div class="col-sm-8">
                            {if $products.0.cache_url}<a href="/{$products.0.cache_url}">{$products.0.product_name}</a>{else}{$products.0.product_name}{/if}
                        </div>
                    </div>
                    {/if}
                    <div class="row detrow hidden">
                        <div class="col-sm-3 col-sm-offset-1">
                            其他：
                        </div>
                        <div class="col-sm-8">
                            <a href="/terms-and-conditions">《条款与规定》</a>
                        </div>
                    </div>
                    <!-- <div class="row detrow hidden">
                        <div class="col-sm-3 col-sm-offset-1">
                            分享课程：
                        </div>
                        <div class="col-sm-8" id="shareclass">
                            <a target="_blank" href="http://www.facebook.com/sharer.php?u={$DOMAIN}{$REQUEST_URI}"><img src="/images/footfb.png" alt="Facebook icon" title="Share this on Facebook" /></a>
                            <a target="_blank" href="http://twitter.com/home?status=Ignite+your+child%27s+passion+for+sport+and+exercise%21+Check+out+Ready+Steady+Go+Kids.+{$DOMAIN}"><img src="/images/foottwitter.png" alt="Twitter icon" title="Share this on Twitter" /></a>
                            <a href="mailto:?subject=Multi-sports for children&body=Hi there%0A%0DHave you heard about Ready Steady Go Kids? It's a multi-sport program for children aged 2.5-6 year olds. I thought you might be interested. You can see more information on their website: {$DOMAIN}%0A%0DCheers!"><img src="/images/footmail.png" alt="Mail icon" title="Share by email" /></a>
                        </div>
                    </div> -->
                </div>
            </div>
        </div>
    </div>
</div>
</div>
{if $franchisees.0.users}
<div class="container hidden-xs" id="meetfranchisee">
    <div class="row">
        <div class="col-sm-12 blue">
            Meet the franchisee/s:
            <br />
            <br />
        </div>
    </div>
    <div id="meetcopy">
        {foreach $franchisees.0.users as $f}
        <div class="row franchisee">
            <div class="col-sm-2">
                {if $f.admin_image}<img src="{$f.admin_image}" class="img-responsive" alt="{$f.admin_name} img" />{/if}
                <div><b>{$f.admin_name}</b></div>
            </div>
            <div class="col-sm-10">
                {$f.admin_description}
            </div>
        </div>
        {/foreach}
    </div>
</div>
{/if}
<div class="visible-xs panel-group" id="accordion">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#accsports" class="collapsed">
          本学期体育项目 <span class="closed">+</span> <span class="open">-</span>
        </a>
      </h4>
        </div>
        <div id="accsports" class="panel-collapse collapse">
            <div class="panel-body">
            </div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#accdetails" class="collapsed">
          课程详情 <span class="closed">+</span> <span class="open">-</span>
        </a>
      </h4>
        </div>
        <div id="accdetails" class="panel-collapse collapse">
            <div class="panel-body">
            </div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#accmeet" class="collapsed">
          了解加盟商<span class="closed">+</span> <span class="open">-</span>
        </a>
      </h4>
        </div>
        <div id="accmeet" class="panel-collapse collapse">
            <div class="panel-body">
            </div>
        </div>
    </div>
</div>
</div>
{if $location_latitude neq '' && $location_longitude neq ''}
<div id="map" data-name="{$location_name}" data-pin="{$location_pin}" data-lat="{$location_latitude}" data-lon="{$location_longitude}" itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
    <meta itemprop="latitude" content="{$location_latitude}" />
    <meta itemprop="longitude" content="{$location_longitude}" />
    <div id="map-canvas">地图加载中...</div>
</div>
{/if} {include file='helpblock.tpl'} {/block} {block name='tail'}
<script type="text/javascript">
if (matchMedia) {
    var mq = window.matchMedia("(max-width: 767px)");
    mq.addListener(WidthChange);
    WidthChange(mq);
}

$('#product-form').validate({
    onkeyup: false,
    onclick: false
});

function WidthChange(mq) {

    if (mq.matches) {
        $("#accsports .panel-body").append($("#sportscopy .row"));
        $("#accdetails .panel-body").append($("#detcopy .row"));
        $("#accmeet .panel-body").append($("#meetcopy .row"));
    } else {
        $("#sportscopy").append($("#accsports .panel-body .row"));
        $("#detcopy").append($("#accdetails .panel-body .row"));
        $("#meetcopy").append($("#accmeet .panel-body .row"));
    }
}

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>
{if $location_latitude neq '' || $location_longitude neq ''}
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=EC576adb282ee6c1abbf65f4ed5fa10e"></script>
<script type="text/javascript">
var map = new BMap.Map("map-canvas"); // 创建Map实例
var point = new BMap.Point($('#map').attr('data-lat'), $('#map').attr('data-lon'));
map.addControl(new BMap.MapTypeControl()); //添加地图类型控件
map.enableDragging();
map.centerAndZoom(point, 16); // 初始化地图,设置中心点坐标和地图级别
var marker = new BMap.Marker(point);
map.addOverlay(marker);
</script>
{/if} {/block}
